#include "DurationCounter.h"

DurationCounter::DurationCounter() {
	mDuration.Minutes = 0;
	mDuration.Seconds = 0;
}

TDuration DurationCounter::getDuration() const {
	return mDuration;
}

void DurationCounter::Visit(Song * song) {
	TDuration dur = *song->getDuration();

	mDuration.Minutes += dur.Minutes;
	mDuration.Seconds += dur.Seconds;
	mDuration.Minutes += mDuration.Seconds / 60;
	mDuration.Seconds %= 60;
}

void DurationCounter::Visit(Album * album) {
	// nothing to do here.
}

void DurationCounter::Visit(MusicCollection * collection) {
	// nothing to do here.
}